/*
 * @lc app=leetcode.cn id=205 lang=javascript
 *
 * [205] 同构字符串
 */

// @lc code=start
/**
 * @param {string} s
 * @param {string} t
 * @return {boolean}
 */
var isIsomorphic = function(s, t) {
    let flag = true
    let strMap = new Map
    if (new Set(s).size !== new Set(t).size) {
        flag = false
        return flag
    }
    for (let index = 0; index < s.length; index++) {
        const element1 = s[index];
        const element2 = t[index];
        if (!strMap.get(element1)) {
            strMap.set(element1, element2)
        } else {
            if (strMap.get(element1) !== element2) {
                flag = false
            }
        }
    }
    return flag
};
// @lc code=end

